<?php

  function eform_validation($form) {

	// district validation

	 distvalidation($form['field_eform_dist']['und']['#value']);

    // Check bad character validation

   	chkbadchar($form['field_eform_desc']['und'][0]['value']['#value'], $form['field_eform_desc']['und'][0]['value']['#title'], 'field_eform_desc');
    chkbadchar($form['title']['#value'], $form['title']['#title'], 'title');
	chkbadchar($form['field_eform_keywords']['und'][0]['value']['#value'],$form['field_eform_keywords']['und'][0]['value']['#title'], 'field_eform_keywords');
	chkbadchar($form['field_eform_othercategory']['und'][0]['value']['#value'],$form['field_eform_othercategory']['und'][0]['value']['#title'], 'field_eform_othercategory');
	chkbadchar($form['field_eform_formno']['und'][0]['value']['#value'],$form['field_eform_formno']['und'][0]['value']['#title'], 'field_eform_formno');

	// maximum length validation for Title and Description Field
  	maxlength_validation($form['title']['#value'], 255, $form['title']['#title'], 'title');

	//echo "ABC".$form['field_eform_desc']['und'][0]['value']['#title'];

	// minimum length charcter
  	minilength_validation($form['title']['#value'], 5, $form['title']['#title'], 'title');
  	minilength_validation($form['field_eform_keywords']['und'][0]['value']['#value'], 5, $form['field_eform_keywords']['und'][0]['value']['#title'],'field_eform_keywords');
	minilength_validation($form['field_eform_desc']['und'][0]['value']['#value'], 5, $form['field_eform_desc']['und'][0]['value']['#title'],'field_eform_desc');

	// Date Validation

    //check_scheduler_date_expire($form['scheduler_settings']['unpublish_on']['date']['#value'],'unpublish_on');

	//check_date_expire($form['field_go_date'][0]['value']['date']['#value'],$form['field_go_date']['#title']);

}
  function eform_presave_validation($node) {
   $reference_url = $node->field_eform_onurl[0]['value'];
   $node->field_eform_onurl[0]['value'] = url_validation($reference_url);
 } // function form_presave_validation()
